{% extends "master.html" %}
{% block subtitle %} - 主面板  - 出入库管理{% endblock %}


{% block main %}
<div class="container">
    <div class="row">
        <ol class="breadcrumb">
          <li><a href="{{url_for('bpRoot.view')}}">主面板</a></li>
          <li class="active">出入库管理</li>
        </ol>
    </div>
    <div class="row">
        <div class="panel panel-primary">
            <div class="panel-heading"><h4 class="panel-title">输入查询条件</h4></div>
            <div class="panel-body">
                <div class="row">{{mymacros.render_search_form(form,3)}}</div>
                <div class="row">
                    <div class="col-md-12">
                        <div class="btn-toolbar pull-right">
                            <div class="btn-group"><button type="button" class="btn btn-primary" onclick="$('form').submit()">查询记录</button></div>
                            {% if getAllPermission(['SUPER_USER',]) %}
                                <div class="btn-group"><a href="{{url_for('bpIvtnt.view',action='add',t=IVTNT_IN)}}" class="btn btn-primary">创建入库单</a></div>
                                <div class="btn-group"><a href="{{url_for('bpIvtnt.view',action='add',t=IVTNT_OUT)}}" class="btn btn-primary">创建出库单</a></div>
                            {% endif %}
                        </div>
                    </div>
                </div>
            </div>

            <table class="table table-bordered">
                <thead>
                    <tr>
                        <td class="col-md-3">系统编号</td>
                        <td class="col-md-2">行为 - 出/入库</td>
                        <td>涉及</td>
                        <td class="col-md-1">状态</td>
                        <td class="col-md-2">经办人</td>
                        <td class="col-md-2">开单时间</td>
                        <td class="col-md-2">收/发货时间</td>
                    </tr>
                </thead>
                <tbody>
                    {% for r in result.items %}
                        <tr>
                            <td><a href="{{url_for('bpIvtnt.view',action='view',id=r.id)}}">{{r.no}}</a></td>
                            <td>{{guessNotp(r.refer)}} - {{r.direction|ss(c='IVTNT')}}</td>
                            <td>{{ mymacros.render_goto_popup(r.refer, loop.first) }}</td>
                            <td>
                                {% if r.status == IVTNT_APPROVE %}
                                    <span style="color: green;">
                                {% elif r.status == IVTNT_NEW %}
                                    <span>
                                {% else %}
                                    <span style="color: red;">
                                {% endif %}
                                {{r.status|ss(c='IVTNT')}}
                                </span>
                            </td>
                            <td>{{r.createBy}}</td>
                            <td>{{r.createTime|fd}}</td>
                            <td>{{r.appTime|ft}}</td>
                        </tr>
                    {% endfor %}
                </tbody>                
            </table>
            {{mymacros.mypaginate(result)}}
        </div>
    </div>
</div>
{% endblock %}